<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>顶部导航栏</title>
    <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
    
    <link rel="stylesheet" href="https://cdn.staticfile.org/ionicons/2.0.1/css/ionicons.min.css">
    <style>
     *{
         padding: 0;
         margin: 0;
         box-sizing: border-box;
         font-family:sans-serif;
     }
     
     body{
         background: #000;
         
         
     }
    header{
    position: fixed;
    top:0 ;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: 0.6s;
    padding: 40px 100px;
    z-index: 10000;

}
header.sticky{
    padding: 5px 100px;
    background-color: #fff;
}
header.sticky ul li a,header.sticky .logo{
    color: #000;
}

header .logo{
    position: relative;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    font-size: 2em;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: 0.6s;

}

header ul{
    display: flex;
    position: relative;
    justify-content: center;
    align-items: center;

}

header ul li{
    position: relative;
    list-style: none;

}
header ul li a {
    position: relative;
    margin:  0 15px;
    text-decoration: none;
    color: #fff;
    font-weight: 500px;
    transition: 0.6s;
    letter-spacing: 2px;

}
.banner{
   position: relative;
    width: 100%;
    height: 1000px;
    background:url(1.jpg) ;
    background-size:cover ;
}
body,html{
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    font-family: sans-serif;
    

}

.sidebar{
    float: left;
    width: 100px;
    height:100% ;
    background: rgb(29, 64, 73);
    overflow: hidden;
    position: relative;
    top: -880px;
    transition: 0.8s  all;
    opacity: 0.5;
}
.sidebar ul{
    margin: 0;
    padding: 0;

}

.side{
    margin-left: -100px;
}

.sidebar ul li{
    list-style: none;
}
.sidebar ul li a {
    text-decoration: none;
    color: white;
    height: 80px;
    width: 100%;
    font-size: 40px;
    line-height: 80px;
    text-align: center;
    display: block;
    transition: 0.5s all;
}
.sidebar ul li a:hover{
    background: #D8EEF3;
}

.btn{
    float: left;
    position: relative;
    top: -880px;
    padding: 0 10px;
    font-size: 40px;
    text-decoration: none;
    color: rgb(29, 64, 73);
    font-family: Ionicons;
    cursor: pointer;
    opacity: 0.5;
}
.btn:before{
    content: '\f12a';
}
.btnc:before{
    content: "\f20d";
}
    </style>
</head>
<body>
     <header>
       <a href="#" class="logo">Logo</a>
       <ul>
           <li><a href="#">Home</a></li>
           <li><a href="#">Services</a></li>
           <li><a href="#">Portfolio</a></li>
           <li><a href="#">Team</a></li>
           <li><a href="#">About</a></li>
           <li><a href="#">Contact</a></li>
       </ul>
   </header>
   <section class="banner"></section> <div class="sidebar">
    <ul>

       <li><a class="icon ion-ios-eye" href="#"></a></li>
       <li><a class="ion-social-instagram" href="#"></a></li>
       <li><a class="ion-android-image" href="#"></a></li>
       <li><a href="#" class="icon ion-ios-analytics"></a></li>
       <li><a class="icon ion-happy-outline" href="#"></a></li>
       <li><a href="#" class="ion-social-apple"></a></li>
       <li><a href= "#" class="ion-social-tux"></a></li>
    </ul>
   </div>

   <a class="btn" href="#"></a>

   <script>
      
   </script>
   <script>
      window.onscroll=function(){
          document.querySelector('header').classList.toggle('sticky',window.scrollY>0)
      } 
      $(".btn").click(function(){
        $('.btn').toggleClass('btnc')
        $('.sidebar').toggleClass('side')
       })
   </script>
</body>
</html>